package com.linux.huhx.socket;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by huhx on 2017-06-29.
 */
public class MainServer {
    public static void main(String[] args) {
        try {
            ServerSocket serverSocket = new ServerSocket(9999);
            ExecutorService executorService = Executors.newFixedThreadPool(10);
            while (true) {
                Socket socket = serverSocket.accept();
                System.out.println("request has accept");
                executorService.execute(new MulitpleThread(socket));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
